﻿using System;
using Microsoft.Practices.ObjectBuilder;
using System.Collections.Generic;
using YakShaver.WCSF.BuildManager.Interface.BusinessEntities;
using YakShaver.WCSF.BuildManager.Interface.Services;

namespace YakShaver.WCSF.BuildManager.Views
{
    public partial class ProjectBuilds : Microsoft.Practices.CompositeWeb.Web.UI.Page, IProjectBuildsView
    {
        private ProjectBuildsPresenter _presenter;
        private IList<IProjectBuild> _projectBuilds;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this._presenter.OnViewInitialized();
            }
            this._presenter.OnViewLoaded();
        }

        [CreateNew]
        public ProjectBuildsPresenter Presenter
        {
            get
            {
                return this._presenter;
            }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");

                this._presenter = value;
                this._presenter.View = this;
            }
        }

        // TODO: Forward events to the presenter and show state to the user.
        // For examples of this, see the View-Presenter (with Application Controller) QuickStart:
        //		ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.practices.wcsf.2007oct/wcsf/html/08da6294-8a4e-46b2-8bbe-ec94c06f1c30.html



        public void SetProjectBuilds(System.Collections.Generic.IList<YakShaver.WCSF.BuildManager.Interface.BusinessEntities.IProjectBuild> projectBuilds)
        {
            _projectBuilds = projectBuilds;
            this.gvProjectBuilds.DataSource = _projectBuilds;
            this.gvProjectBuilds.DataBind();

        }


        #region IProjectBuildsView Members


        public IProject Project
        {
            get
            {
               
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion

        #region IProjectBuildsView Members


        public string ProjectId
        {
            get { return Request["projectId"]; }
        }

        #endregion
    }
}

